home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 97 / CD-ROM 97 / CD-ROM 97.iso / internet / ghostzilla / ghsetup.exe / chrome / comm.jar / content / cookie / cookieTasksOverlay.xul < prev    next >
Encoding:
Extensible Markup Language  |  2002-04-09  |  4.2 KB  |  120 lines

  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4.    The contents of this file are subject to the Netscape Public
  5.    License Version 1.1 (the "License"); you may not use this file
  6.    except in compliance with the License. You may obtain a copy of
  7.    the License at http://www.mozilla.org/NPL/
  8.     
  9.    Software distributed under the License is distributed on an "AS
  10.    IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  11.    implied. See the License for the specific language governing
  12.    rights and limitations under the License.
  13.     
  14.    The Original Code is Mozilla Communicator client code, released
  15.    March 31, 1998.
  16.    
  17.    The Initial Developer of the Original Code is Netscape
  18.    Communications Corporation. Portions created by Netscape are
  19.    Copyright (C) 1998-1999 Netscape Communications Corporation. All
  20.    Rights Reserved.
  21.    
  22.    Contributor(s): 
  23.   -->
  24.  
  25. <!DOCTYPE window SYSTEM "chrome://cookie/locale/cookieTasksOverlay.dtd">
  26.  
  27. <overlay id="cookieTasksOverlay"
  28.          xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  29.  
  30.   <script type="application/x-javascript" src="chrome://cookie/content/cookieOverlay.js"/>
  31.  
  32.   <script type="application/x-javascript">
  33.   <![CDATA[
  34.  
  35.     /******* THE FOLLOWING IS FOR THE STATUSBAR OVERLAY *******/
  36.  
  37.     var gObserverService;
  38.     var gPref;
  39.     var gButtonPressed;
  40.  
  41.     var cookieIconObserver = {
  42.       observe: function(subject, topic, state) {
  43.         if (topic != "cookieIcon" || !document) {
  44.           return;
  45.         }
  46.         var cookieIcon = document.getElementById("privacy-button");
  47.         if (cookieIcon) {
  48.           if (state == "on") {
  49.             cookieIcon.removeAttribute("hidden");
  50.           } else if (state == "off")  {
  51.             cookieIcon.setAttribute("hidden", "true");
  52.           }
  53.         }
  54.       }
  55.     }
  56.  
  57.     var listener = {
  58.       handleEvent: function(event) {
  59.         var cookieservice = Components.classes["@mozilla.org/cookieService;1"].getService();
  60.         cookieservice = cookieservice.QueryInterface(Components.interfaces.nsICookieService);
  61.         if (cookieservice.cookieIconIsVisible) {
  62.           var cookieIcon = document.getElementById("privacy-button");
  63.           if (cookieIcon) {
  64.             cookieIcon.removeAttribute("hidden");
  65.           }
  66.         }
  67.       }
  68.     };
  69.  
  70.     function viewP3PDialog() {
  71.       if (!gObserverService) {
  72.         gObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
  73.       }
  74.       gObserverService.notifyObservers(null, "cookieIcon", "off");
  75.  
  76.       window.openDialog
  77.         ("chrome://cookie/content/p3pDialog.xul","_blank","modal=yes,chrome,resizable=no", this);
  78.       if (gButtonPressed == "cookie") {
  79.         viewCookiesFromIcon();
  80.       } else if (gButtonPressed == "p3p") {
  81.         viewP3P();
  82.       }
  83.     }
  84.  
  85.     // determine if p3p pref is set
  86.     gPref = Components.classes['@mozilla.org/preferences-service;1'];
  87.     gPref = gPref.getService();
  88.     gPref = gPref.QueryInterface(Components.interfaces.nsIPrefBranch);
  89.     if (gPref.getIntPref("network.cookie.cookieBehavior") == 3) {
  90.  
  91.       // make sure p3p dll exists, else we can't keep pref set
  92.       if (!("@mozilla.org/cookie-consent;1" in Components.classes)) {
  93.         gPref.setIntPref("network.cookie.cookieBehavior", 0);
  94.       } else {
  95.  
  96.         // p3p pref is set so create an observer for changes in visibility of cookie icon
  97.         var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
  98.         observerService.addObserver(cookieIconObserver, "cookieIcon", false);
  99.  
  100.         // determine whether or not cookie icon in this new window should be displayed
  101.         // we need to wait until window is created before displaying icon
  102.         addEventListener("load", listener, false);
  103.       }
  104.     }
  105.   ]]>
  106.   </script>         
  107.  
  108.   <!-- statusbarOverlay items -->
  109.  
  110.   <statusbar id="status-bar">
  111.     <statusbarpanel class="statusbarpanel-iconic" id="privacy-button"
  112.                     hidden="true" insertbefore="security-button"
  113.                     oncommand="viewP3PDialog()" tooltiptext="&cookieIcon.label;">
  114.       <toolbarbutton class="taskbutton" id="mini-cookie"
  115.                      image="chrome://cookie/content/taskbar-cookie.gif"/>
  116.     </statusbarpanel>
  117.   </statusbar>
  118.  
  119. </overlay>
  120.